package com.csl.xm.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <pre>
 * 描述：redis测试控制器
 * </pre>
 *
 * @类名：com.csl.xm.demo.controller.RedisController
 * @作者： 1410HL0236
 * @创建日期: 2019/11/20 15:02
 */
@RestController
@RequestMapping("/redis")
public class RedisController {
  @Autowired
  private StringRedisTemplate stringRedisTemplate;


  @GetMapping(value = "/redisAdd")
  public void saveRedis(){
    stringRedisTemplate.opsForValue().set("a","test");
  }

  @GetMapping("/redisGet")
  public String getRedis(){
    return stringRedisTemplate.opsForValue().get("a");
  }



}
